package com.shenmazong.controller;


import com.shenmazong.entity.TbTeach;
import com.shenmazong.service.TbTeachService;
import com.shenmazong.utils.ResultResponse;
import com.shenmazong.vo.ListParamVo;
import org.springframework.web.bind.annotation.*;

import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import javax.xml.transform.Result;

/**
 * <p>
 * 教材表 ——> John
 前端控制器
 * </p>
 *
 * @author 还怕大雨吗
 * @since 2021-09-18
 */
@RestController
@RequestMapping("/tbTeach")
@CrossOrigin
public class TbTeachController {

    @Resource
    private TbTeachService tbTeachService;

    /***
     * @description 查询大纲对应的教材
     * @params [listParamVo]
     * @return com.shenmazong.utils.ResultResponse
     * @author -还怕大雨吗
     * @date 2021/9/18 16:27
     */
    @PostMapping("/selectTeach")
    public ResultResponse selectTeach(@RequestBody ListParamVo listParamVo){
        return tbTeachService.selectTeach(listParamVo);
    }


    /***
     * @description 新增对应教材
     * @params [listParamVo]
     * @return com.shenmazong.utils.ResultResponse
     * @author -还怕大雨吗
     * @date 2021/9/18 16:32
     */
    @PostMapping("/insertTeach")
    public ResultResponse insertTeach(@RequestBody TbTeach tbTeach){
        return tbTeachService.insertTeach(tbTeach);
    }

    /***
     * @description 修改对应教材
     * @params [listParamVo]
     * @return com.shenmazong.utils.ResultResponse
     * @author -还怕大雨吗
     * @date 2021/9/18 16:33
     */
    @PostMapping("/updateTeach")
    public ResultResponse updateTeach(@RequestBody TbTeach tbTeach){



        return tbTeachService.updateTeach(tbTeach);
    }

    /***
     * @description 删除对应教材
     * @params [listParamVo]
     * @return com.shenmazong.utils.ResultResponse
     * @author -还怕大雨吗
     * @date 2021/9/18 16:37
     */
    @PostMapping("/deleteTeach")
    public ResultResponse deleteTeach(Long listParamVo){
        return tbTeachService.deleteTeach(listParamVo);
    }


    /***
     * @description 上传图片
     * @params [file]
     * @return com.shenmazong.utils.ResultResponse
     * @author -还怕大雨吗
     * @date 2021/9/22 14:07
     */
    @PostMapping("/uploadTeachimages")
    public ResultResponse uploadTeachimages(MultipartFile file){
        return tbTeachService.uploadTeachimages(file);
    }




}

